/*
 * XML Type:  entity-listeners
 * Namespace: http://java.sun.com/xml/ns/persistence/orm
 * Java type: com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListeners
 *
 * Automatically generated - do not modify.
 */
package com.googlecode.horncomb.orm.jpa.v10.xmlbeans.impl;
/**
 * An XML entity-listeners(@http://java.sun.com/xml/ns/persistence/orm).
 *
 * This is a complex type.
 */
@SuppressWarnings("unchecked")
public class EntityListenersImpl extends org.apache.xmlbeans.impl.values.XmlComplexContentImpl implements com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListeners
{

    /**  */
	private static final long serialVersionUID = -7352149522669615803L;


	public EntityListenersImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }

    private static final javax.xml.namespace.QName ENTITYLISTENER$0 =
        new javax.xml.namespace.QName("http://java.sun.com/xml/ns/persistence/orm", "entity-listener");


    /**
     * Gets a List of "entity-listener" elements
     */
    public java.util.List<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener> getEntityListenerList()
    {
        final class EntityListenerList extends java.util.AbstractList<com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener>
        {
            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener get(int i)
                { return EntityListenersImpl.this.getEntityListenerArray(i); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener set(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener o)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener old = EntityListenersImpl.this.getEntityListenerArray(i);
                EntityListenersImpl.this.setEntityListenerArray(i, o);
                return old;
            }

            @Override
			public void add(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener o)
                { EntityListenersImpl.this.insertNewEntityListener(i).set(o); }

            @Override
			public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener remove(int i)
            {
                com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener old = EntityListenersImpl.this.getEntityListenerArray(i);
                EntityListenersImpl.this.removeEntityListener(i);
                return old;
            }

            @Override
			public int size()
                { return EntityListenersImpl.this.sizeOfEntityListenerArray(); }

        }

        synchronized (monitor())
        {
            check_orphaned();
            return new EntityListenerList();
        }
    }

    /**
     * Gets array of all "entity-listener" elements
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener[] getEntityListenerArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(ENTITYLISTENER$0, targetList);
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener[] result = new com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }

    /**
     * Gets ith "entity-listener" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener getEntityListenerArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener)get_store().find_element_user(ENTITYLISTENER$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }

    /**
     * Returns number of "entity-listener" element
     */
    public int sizeOfEntityListenerArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(ENTITYLISTENER$0);
        }
    }

    /**
     * Sets array of all "entity-listener" element
     */
    public void setEntityListenerArray(com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener[] entityListenerArray)
    {
        synchronized (monitor())
        {
            check_orphaned();
            arraySetterHelper(entityListenerArray, ENTITYLISTENER$0);
        }
    }

    /**
     * Sets ith "entity-listener" element
     */
    public void setEntityListenerArray(int i, com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener entityListener)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener)get_store().find_element_user(ENTITYLISTENER$0, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(entityListener);
        }
    }

    /**
     * Inserts and returns a new empty value (as xml) as the ith "entity-listener" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener insertNewEntityListener(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener)get_store().insert_element_user(ENTITYLISTENER$0, i);
            return target;
        }
    }

    /**
     * Appends and returns a new empty value (as xml) as the last "entity-listener" element
     */
    public com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener addNewEntityListener()
    {
        synchronized (monitor())
        {
            check_orphaned();
            com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener target = null;
            target = (com.googlecode.horncomb.orm.jpa.v10.xmlbeans.EntityListener)get_store().add_element_user(ENTITYLISTENER$0);
            return target;
        }
    }

    /**
     * Removes the ith "entity-listener" element
     */
    public void removeEntityListener(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(ENTITYLISTENER$0, i);
        }
    }
}
